//
//  JQVisitorController.swift
//  sinaWeibo
//
//  Created by maoge on 16/4/16.
//  Copyright © 2016年 maoge. All rights reserved.
//

import UIKit


class JQVisitorController: UITableViewController, JQVisitorViewDelegate {

    //用户是否登录
    var userLogin: Bool = false
    
    
    override func loadView() {
        //        super.loadView()
        
        if userLogin {
            super.loadView()
        }else {
            setupVisitorView()
        }
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        
    }
    
    //设置view
    private func setupVisitorView() {
        view = vistorView
        
        //设置左右item
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "registerBtnClick")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: "loginBtnCLick")
    }
    
    lazy var vistorView: JQVisitorView = {
        let view = JQVisitorView()
        
        view.delegate = self
        
        return view
    }()
    
    //实现代理方法
    func loginBtnCLick() {
        print("ddd")
    }
    
    func registerBtnClick() {
        print("registor")
    }
        
}
